// 全局样式
@import './variables.scss';

// 全局重置
* {
  box-sizing: border-box;
}

// 页面基础样式
page {
  background-color: $bg-secondary;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: $font-base;
  line-height: 1.6;
  color: $text-primary;
}

// 统一页面头部样式
.page-header {
  position: relative;
  background: $gradient-primary;
  color: $text-white;
  padding: $header-padding;
  margin-bottom: $spacing-lg;
  border-radius: 0 0 $radius-2xl $radius-2xl;
  box-shadow: $shadow-md;
  
  &::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%);
    border-radius: 0 0 $radius-2xl $radius-2xl;
  }
  
  .page-title {
    font-size: $font-3xl;
    font-weight: $font-bold;
    margin-bottom: $spacing-sm;
    position: relative;
    z-index: 1;
  }
  
  .page-subtitle {
    font-size: $font-base;
    opacity: 0.9;
    position: relative;
    z-index: 1;
  }
}

// 卡片样式
.card {
  background: $bg-primary;
  border-radius: $radius-xl;
  padding: $spacing-xl;
  margin-bottom: $spacing-lg;
  box-shadow: $shadow-sm;
  transition: all $transition-base;
  
  &:hover {
    box-shadow: $shadow-md;
    transform: translateY(-2rpx);
  }
  
  .card-title {
    font-size: $font-xl;
    font-weight: $font-semibold;
    color: $text-primary;
    margin-bottom: $spacing-lg;
  }
}

// 按钮样式
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: $spacing-md $spacing-xl;
  border-radius: $radius-lg;
  font-size: $font-base;
  font-weight: $font-medium;
  text-align: center;
  transition: all $transition-base;
  border: none;
  cursor: pointer;
  
  &.btn-primary {
    background: $gradient-primary;
    color: $text-white;
    box-shadow: $shadow-sm;
    
    &:hover {
      box-shadow: $shadow-md;
      transform: translateY(-1rpx);
    }
  }
  
  &.btn-secondary {
    background: $bg-primary;
    color: $text-primary;
    border: 2rpx solid $gray-300;
    
    &:hover {
      border-color: $primary-color;
      color: $primary-color;
    }
  }
}

// 列表样式
.list {
  .list-item {
    display: flex;
    align-items: center;
    padding: $spacing-lg 0;
    border-bottom: 1rpx solid $gray-200;
    transition: background-color $transition-fast;
    
    &:last-child {
      border-bottom: none;
    }
    
    &:active {
      background-color: $gray-50;
    }
    
    .list-icon {
      width: 80rpx;
      height: 80rpx;
      border-radius: $radius-full;
      display: flex;
      align-items: center;
      justify-content: center;
      margin-right: $spacing-lg;
      font-size: 36rpx;
    }
    
    .list-content {
      flex: 1;
      
      .list-title {
        font-size: $font-lg;
        font-weight: $font-medium;
        color: $text-primary;
        margin-bottom: $spacing-xs;
      }
      
      .list-desc {
        font-size: $font-sm;
        color: $text-secondary;
      }
    }
    
    .list-arrow {
      font-size: $font-lg;
      color: $gray-400;
    }
  }
}

// 网格布局
.grid {
  display: grid;
  gap: $spacing-lg;
  
  &.grid-2 {
    grid-template-columns: repeat(2, 1fr);
  }
  
  &.grid-3 {
    grid-template-columns: repeat(3, 1fr);
  }
  
  &.grid-4 {
    grid-template-columns: repeat(4, 1fr);
  }
}

// 工具类
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-row { flex-direction: row; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }

.w-full { width: 100%; }
.h-full { height: 100%; }

.mb-sm { margin-bottom: $spacing-sm; }
.mb-md { margin-bottom: $spacing-md; }
.mb-lg { margin-bottom: $spacing-lg; }
.mb-xl { margin-bottom: $spacing-xl; }

.p-sm { padding: $spacing-sm; }
.p-md { padding: $spacing-md; }
.p-lg { padding: $spacing-lg; }
.p-xl { padding: $spacing-xl; }

// 动画类
.fade-in {
  animation: fadeIn $transition-slow ease-in-out;
}

.slide-up {
  animation: slideUp $transition-base ease-out;
}

.bounce-in {
  animation: bounceIn $transition-base ease-out;
}

.pulse {
  animation: pulse 2s infinite;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { 
    opacity: 0;
    transform: translateY(30rpx);
  }
  to { 
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes bounceIn {
  0% {
    opacity: 0;
    transform: scale(0.3);
  }
  50% {
    opacity: 1;
    transform: scale(1.05);
  }
  70% {
    transform: scale(0.9);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes pulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
  100% {
    transform: scale(1);
  }
}

// 页面进入动画
.page-enter {
  animation: pageEnter $transition-slow ease-out;
}

@keyframes pageEnter {
  from {
    opacity: 0;
    transform: translateY(50rpx);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

// 卡片悬停效果
.card-hover {
  transition: all $transition-base;
  
  &:hover {
    transform: translateY(-4rpx);
    box-shadow: $shadow-lg;
  }
}

// 按钮点击效果
.btn-press {
  transition: all $transition-fast;
  
  &:active {
    transform: scale(0.95);
  }
}
